package xrz.cuanbao.views;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class EmjoyGridViewAdapter extends BaseAdapter{

	private Context m_Context;
	private int page;
	private int [] res;
	public EmjoyGridViewAdapter(Context ctx, int page){
		this.m_Context = ctx;
		this.page = page;
		res = EmjoyUtils.getPageRes(page);
	}

	
	@Override
	public int getCount() {
		return EmjoyUtils.getPageSize(page);
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView;
		if(convertView == null){
			imageView = new ImageView(m_Context);
			convertView = imageView;
		}else{
			imageView = (ImageView) convertView;
		}
		imageView.setImageResource(res[position]);
		return convertView;
	}

}
